#pragma once

#include "GameEditor.h"
#include "GUIWindow.h"
#include "GUITree.h"
#include "GUITextbox.h"
#include "GUIButton.h"
#include "GUIListBox.h"
#include "GUILabel.h"
#include "GUIComboBox.h"
#include "GUIMenuItem.h"
#include "GUIMenu.h"

class GameEditorGUI
{
public:
	GameEditorGUI(GameEditor* editor);
	
	void ShowLoadStateWindow();
	void ShowSaveStateWindow();

	void ShowControllerWindow();
	void ShowLoadModelWindow();
	void ShowCreateWorldWindow();
	void ShowSetWorldWindow();
	void ShowCreateTerrainWindow();
	void ShowSceneGraphWindow();
	void ShowEntitiesWindow();
	void ShowLoadTextureWindow();
	void ShowSelectableBodyShapes();
	void ShowRigidBodyShapes();
	void ShowLightProperties( Pointer<LightNode>& light );

	void CreateEntity();
	void CreateLight();
	void CreateAI();
	void CreateTerrain();
	void CreateWorld();

	void CancelCreateTerrain();
	void CancelCreateWorld();
	void CancelLoadTexture();
	void CancelLoadModel();
	void CancelSetWorld();
	void CancelSaveState();
	void CancelLoadState();

	void SaveState();
	void LoadState();
	void LoadTexture();
	void LoadModel();

	void HideSelectableBodyShapes();
	void HideRigidBodyShapes();
	void HideSceneGraph();
	void HideAIWindow();
	void HideEntityWindow();

	void DeleteAllSelectableBodyShapes();
	void DeleteSelectableBodyShape();
	void DeleteAllRigidBodyShapes();
	void DeleteRigidBodyShape();
	void DeleteSceneGraphNode();
	void DeleteEntityByName();
	void DeleteAIBehavior();
	void DeleteEntity( Entity* entity );

	void SetEntityGraphic();
	void SetEntityPosition();
	void SetLightPosition();
	void SetWorld();
	void SetEntityName();

	void AddRigidbodyShape();
	void AddSelectablebodyShape();
	void AddMinionBehavior();
	void AddSpawnPointBehavior();

	void ChangeSelected( Entity* selected );
	void OnEntityListSelectedChange();
	void OnSceneNodeChangeSelected();
	void DragDropSceneGraph();

	void ToggleAddDestination();
protected:
	GameEditor* m_gameEditor;
	
public:
	// GUI Components
#pragma region SceneGraphControls
	Pointer<GUIWindow> wndSceneGraphDisplay;
	Pointer<GUITree> treSceneGraphNodes;
#pragma endregion
#pragma region TerrainControls
	Pointer<GUIWindow> wndCreateTerrain;
	Pointer<GUITextbox> txtTerrainHeightmapFileName;
	Pointer<GUITextbox> txtTerrainName;
	Pointer<GUITextbox> txtTerrainPixelStep;
	Pointer<GUITextbox> txtTerrainTextures;
#pragma endregion
#pragma region Toolbox
	Pointer<GUIWindow> wndToolbox;
#pragma endregion
#pragma region AIToolbox
	Pointer<GUIWindow> wndAIToolbox;
#pragma endregion
#pragma region AIBehaviorWindow
	Pointer<GUIWindow> wndAIWindow;
	Pointer<GUILabel> lblBehaviorType;
	Pointer<GUIButton> btnAIDelete;
	Pointer<GUIButton> btnAIDeleteCancel;
#pragma endregion
#pragma region EntityListWindow
	Pointer<GUIWindow> wndEntityList;
	Pointer<GUIListBox> lstEntityNames;
	Pointer<GUIButton> btnEntityDelete;
	Pointer<GUIButton> btnEntityDeleteCancel;
#pragma endregion
#pragma region PropertiesControls
	Pointer<GUIWindow> wndProperties;
	Pointer<GUIMenu> mnuEntityProperties;
	Pointer<GUITextbox> txtPositionX;
	Pointer<GUITextbox> txtPositionY;
	Pointer<GUITextbox> txtPositionZ;
	
	Pointer<GUIMenuItem> mitController;	
	Pointer<GUIButton> btnShowController;

	Pointer<GUIMenuItem> mitEntityPathfinder;	
	Pointer<GUITextbox> txtWaypointGroup;

	Pointer<GUIComboBox> cmbModelName;

	Pointer<GUITextbox> txtBodyPositionX;
	Pointer<GUITextbox> txtBodyPositionY;
	Pointer<GUITextbox> txtBodyPositionZ;
	Pointer<GUIComboBox> cmbRigidBodyTypes;
	
	Pointer<GUITextbox> txtSelectableBodyPositionX;
	Pointer<GUITextbox> txtSelectableBodyPositionY;
	Pointer<GUITextbox> txtSelectableBodyPositionZ;
	Pointer<GUIComboBox> cmbSelectableBodyTypes;

	Pointer<GUITextbox> txtEntityName;

	Pointer<GUIMenu> mnuLightProperties;
	Pointer<GUITextbox> txtLightPositionX;
	Pointer<GUITextbox> txtLightPositionY;
	Pointer<GUITextbox> txtLightPositionZ;

	Pointer<GUITextbox> txtLightAmbientR;
	Pointer<GUITextbox> txtLightAmbientG;
	Pointer<GUITextbox> txtLightAmbientB;
	
	Pointer<GUITextbox> txtLightDiffuseR;
	Pointer<GUITextbox> txtLightDiffuseG;
	Pointer<GUITextbox> txtLightDiffuseB;
	
	Pointer<GUITextbox> txtLightSpecularR;
	Pointer<GUITextbox> txtLightSpecularG;
	Pointer<GUITextbox> txtLightSpecularB;
#pragma endregion
#pragma region LoadStateControls
	Pointer<GUIWindow> wndLoadState;
	Pointer<GUITextbox> txtLoadStateFileName;
#pragma endregion
#pragma region SaveStateControls
	Pointer<GUIWindow> wndSaveState;
	Pointer<GUITextbox> txtSaveStateFileName;
#pragma endregion
#pragma region SelectableBodyDisplayControl
	Pointer<GUIWindow> wndSelectableBodyDisplay;
	Pointer<GUIListBox> lstSelectableBodyShapes;
	Pointer<GUIButton> btnSelectableBodyDelete;
	Pointer<GUIButton> btnSelectableBodyDeleteAll;
	Pointer<GUIButton> btnSelectableBodyCancel;
#pragma endregion
#pragma region RigidBodyDisplayControl
	Pointer<GUIWindow> wndRigidBodyDisplay;
	Pointer<GUIListBox> lstRigidBodyShapes;
	Pointer<GUIButton> btnRigidBodyDelete;
	Pointer<GUIButton> btnRigidBodyDeleteAll;
	Pointer<GUIButton> btnRigidBodyCancel;
#pragma endregion
#pragma region LoadTextureControls
	Pointer<GUIWindow> wndLoadTexture;
	Pointer<GUITextbox> txtTextureFileName;
#pragma endregion
#pragma region CreateWorldControls
	Pointer<GUIWindow> wndCreateWorld;
	Pointer<GUITextbox> txtWorldName;
#pragma endregion
#pragma region SetWorldControls
	Pointer<GUIWindow> wndSetToWorld;
	Pointer<GUITextbox> txtSetToWorldName;
#pragma endregion
#pragma region LoadModelControls
	Pointer<GUIWindow> wndLoadModel;
	Pointer<GUITextbox> txtModelFileName;
#pragma endregion
};